From 258e7567f59010311cd2776dd14fb991babcef50 Mon Sep 17 00:00:00 2001 From: addshore Date: Sat, 14 Oct 2017 11:17:39 +0100 Subject: [PATCH] RevisionIntegrationTest for newFromPageId Change-Id: I09cf5fcbacab662e30acda1687ebcfe6b29f1900 --- .../includes/RevisionIntegrationTest.php | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/tests/phpunit/includes/RevisionIntegrationTest.php b/tests/phpunit/includes/RevisionIntegrationTest.php index 5d96abf45c..4904f02036 100644 --- a/tests/phpunit/includes/RevisionIntegrationTest.php +++ b/tests/phpunit/includes/RevisionIntegrationTest.php @@ -260,6 +260,46 @@ class RevisionIntegrationTest extends MediaWikiTestCase { $this->assertRevEquals( $orig, $rev ); } + /** + * @covers Revision::newFromPageId + */ + public function testNewFromPageId() { + $rev = Revision::newFromPageId( $this->testPage->getId() ); + $this->assertRevEquals( + $this->testPage->getRevision(), + $rev + ); + } + + /** + * @covers Revision::newFromPageId + */ + public function testNewFromPageIdWithLatestId() { + $rev = Revision::newFromPageId( + $this->testPage->getId(), + $this->testPage->getLatest() + ); + $this->assertRevEquals( + $this->testPage->getRevision(), + $rev + ); + } + + /** + * @covers Revision::newFromPageId + */ + public function testNewFromPageIdWithNotLatestId() { + $this->testPage->doEditContent( new WikitextContent( __METHOD__ ), __METHOD__ ); + $rev = Revision::newFromPageId( + $this->testPage->getId(), + $this->testPage->getRevision()->getPrevious()->getId() + ); + $this->assertRevEquals( + $this->testPage->getRevision()->getPrevious(), + $rev + ); + } + /** * @covers Revision::fetchRevision */ -- 2.20.1